| ['user www-data;\n', 'worker_processes 8; #进程数不要用auto\n', 'pid /run/nginx.pid;\n', 'include /etc/nginx/modules-enabled/*.conf; #动态模块加载\n', '\n', 'events {\n', '\tworker_connections 1024000;\n', '\t# multi_accept on;\n', '}\n', '\n', 'http {\n', ' vhost_traffic_status_zone; # vts 数据采集模块\n', ' gzip on;\n', ' gzip_disable "MSIE [1-6]\\.(?!.*SV1)";\n', ' gzip_proxied any;\n', ' gzip_buffers 16 8k;\n', ' gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;\n', ' gzip_vary on;\n', '\n', ' server_tokens off; # returns "Server: nginx"\n', '\n', ' include mime.types;\n', ' proxy_set_header X-Real-IP $remote_addr;\n', ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n', ' proxy_set_header Host $http_host;\n', ' add_header X-Frame-Options SAMEORIGIN;\n', ' add_header X-Content-Type-Options "nosniff";\n', ' add_header X-XSS-Protection "1; mode=block";\n', ' real_ip_recursive on;\n', '\n', ' server_names_hash_bucket_size 128;\n', ' server_names_hash_max_size 2048;\n', '\n', ' proxy_headers_hash_bucket_size 256;\n', ' proxy_headers_hash_max_size 2048;\n', '\n', ' variables_hash_bucket_size 128;\n', ' variables_hash_max_size 2048;\n', ' log_format time_detail \'$http_x_forwarded_for[$remote_addr][$host] - $remote_user [$time_local] "$request" \'\n', ' \'$status $body_bytes_sent $request_length "$http_referer" \'\n', ' \'"$http_user_agent" "$http_x_forwarded_for"\'\n', " '$connection $upstream_addr '\n", " 'upstream_response_time $upstream_response_time request_time $request_time upstream_connect_time $upstream_connect_time upstream_header_time $upstream_header_time ';\n", ' log_format main \'$remote_addr[$host] - $remote_user [$time_local] "$request" \'\n', ' \'$status $body_bytes_sent "$http_referer" \'\n', ' \'"$http_user_agent" "$http_x_forwarded_for"\'\n', " '$connection $upstream_addr '\n", " 'upstream_response_time $upstream_response_time request_time $request_time ';\n", '\n', '\tinclude /etc/nginx/conf.d/*.conf;\n', '}\n', '\n', 'stream{\n', " log_format main '$remote_addr - [$time_local] '\n", " '$protocol $status $bytes_sent $bytes_received '\n", ' \'$session_time "$upstream_addr" \'\n', ' \'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time" \'\n', " '$remote_addr $remote_port $server_addr $server_port';\n", ' include /etc/nginx/streams/*.conf;\n', '}\n', '\n'] | [] | ||||
|---|---|---|---|---|---|
| t | 1 | user www-data; | t | ||
| 2 | worker_processes 8; #进程数不要用auto | ||||
| 3 | pid /run/nginx.pid; | ||||
| 4 | include /etc/nginx/modules-enabled/*.conf; #动态模块加载 | ||||
| 5 | |||||
| 6 | events { | ||||
| 7 | worker_connections 1024000; | ||||
| 8 | # multi_accept on; | ||||
| 9 | } | ||||
| 10 | |||||
| 11 | http { | ||||
| 12 | vhost_traffic_status_zone; # vts 数据采集模块 | ||||
| 13 | gzip on; | ||||
| 14 | gzip_disable "MSIE [1-6]\.(?!.*SV1)"; | ||||
| 15 | gzip_proxied any; | ||||
| 16 | gzip_buffers 16 8k; | ||||
| 17 | gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css; | ||||
| 18 | gzip_vary on; | ||||
| 19 | |||||
| 20 | server_tokens off; # returns "Server: nginx" | ||||
| 21 | |||||
| 22 | include mime.types; | ||||
| 23 | proxy_set_header X-Real-IP $remote_addr; | ||||
| 24 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||||
| 25 | proxy_set_header Host $http_host; | ||||
| 26 | add_header X-Frame-Options SAMEORIGIN; | ||||
| 27 | add_header X-Content-Type-Options "nosniff"; | ||||
| 28 | add_header X-XSS-Protection "1; mode=block"; | ||||
| 29 | real_ip_recursive on; | ||||
| 30 | |||||
| 31 | server_names_hash_bucket_size 128; | ||||
| 32 | server_names_hash_max_size 2048; | ||||
| 33 | |||||
| 34 | proxy_headers_hash_bucket_size 256; | ||||
| 35 | proxy_headers_hash_max_size 2048; | ||||
| 36 | |||||
| 37 | variables_hash_bucket_size 128; | ||||
| 38 | variables_hash_max_size 2048; | ||||
| 39 | log_format time_detail '$http_x_forwarded_for[$remote_addr][$host] - $remote_user [$time_local] "$request" ' | ||||
| 40 | '$status $body_bytes_sent $request_length "$http_referer" ' | ||||
| 41 | '"$http_user_agent" "$http_x_forwarded_for"' | ||||
| 42 | '$connection $upstream_addr ' | ||||
| 43 | 'upstream_response_time $upstream_response_time request_time $request_time upstream_connect_time $upstream_connect_time upstream_header_time $upstream_header_time '; | ||||
| 44 | log_format main '$remote_addr[$host] - $remote_user [$time_local] "$request" ' | ||||
| 45 | '$status $body_bytes_sent "$http_referer" ' | ||||
| 46 | '"$http_user_agent" "$http_x_forwarded_for"' | ||||
| 47 | '$connection $upstream_addr ' | ||||
| 48 | 'upstream_response_time $upstream_response_time request_time $request_time '; | ||||
| 49 | |||||
| 50 | include /etc/nginx/conf.d/*.conf; | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | stream{ | ||||
| 54 | log_format main '$remote_addr - [$time_local] ' | ||||
| 55 | '$protocol $status $bytes_sent $bytes_received ' | ||||
| 56 | '$session_time "$upstream_addr" ' | ||||
| 57 | '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time" ' | ||||
| 58 | '$remote_addr $remote_port $server_addr $server_port'; | ||||
| 59 | include /etc/nginx/streams/*.conf; | ||||
| 60 | } | ||||
| 61 | |||||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||